import {post_json,get,post} from '../../http/axios'
export default{
    namespaced:true,
    state:{
        categoryInfo:[],
        productInfo:[]
    },
    getters:{},
    mutations:{
        setCategoryInfo(state,data){
            state.categoryInfo = data
        },
        setProductInfo(state,data){
            state.productInfo = data
        }
    },
    actions:{
        async loadProductInfo(context,params){
            let res = await get('/product/findAll')
            context.commit('setProductInfo',res.data);
        },
        async loadCategoryInfo(context,params){
            let res = await post('/category/query',params)
            context.commit('setCategoryInfo',res.data.list);
        }
    }
}